package com.h2.common.util.context.spring;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.h2.util.context.ContextWrapper;

public class SpringContextWrapper implements ContextWrapper {
   
   private ClassPathXmlApplicationContext _context;
   
   ////
   ////
   
   public void init(String path) {
      setContext(new ClassPathXmlApplicationContext(path));
   }

   public <T> T getBean(String name, Class<T> requiredType) {
      return getContext().getBean(name, requiredType);
   }

   /**
    * @return the context
    */
   public ClassPathXmlApplicationContext getContext() {
      return _context;
   }

   /**
    * @param context the context to set
    */
   public void setContext(ClassPathXmlApplicationContext context) {
      _context = context;
   }
   
}
